1826F - Fading into Fog - CodeForces Solution


geometry interactive math probabilities

Please click on ads to support us..

C++ Code:

#include<bits/stdc++.h>
#define rep(i,x,y) for(int i=x;i<=y;i++)
#define int long long
#define db long double
using namespace std;int n;
vector<array<db,2>> ask(db a,db b,db c) {
    cout<<"? "<<a<<" "<<b<<" "<<c<<endl;
    vector<array<db,2>>tmp(n);
    for(auto &[x,y]:tmp)cin>>x>>y;
    return tmp;
}void solve(){
    cout<<fixed<<setprecision(3);cin>>n;
    vector<double>X,Y,Z;
    for(auto [x,y]:ask(0,1,0))X.push_back(x);
    for(auto [x,y]:ask(1,0,0))Y.push_back(y);
    for(auto [x,y]:ask(-0.25,50.25,0))Z.push_back(x);
    cout<<"! ";double K=201;
    for(auto x:Z)rep(i,0,n-1)rep(j,0,n-1){
            double res=(K*X[i]+Y[j])*K/(K*K+1);
            if(fabs(res-x)<5e-4)
                cout<<X[i]<<" "<<Y[j]<<" ";
        }cout<<endl;
}signed main() {
    cin.tie(0)->sync_with_stdio(0);
    int tc;cin>>tc;
    for(int i=1;i<=tc;i++)
        solve();return 0; 
}


Comments

Submit
0 Comments
More Questions

345. Reverse Vowels of a String
628. Maximum Product of Three Numbers
1526A - Mean Inequality
1526B - I Hate 1111
1881. Maximum Value after Insertion
237. Delete Node in a Linked List
27. Remove Element
39. Combination Sum
378. Kth Smallest Element in a Sorted Matrix
162. Find Peak Element
1529A - Eshag Loves Big Arrays
19. Remove Nth Node From End of List
925. Long Pressed Name
1051. Height Checker
695. Max Area of Island
402. Remove K Digits
97. Interleaving String
543. Diameter of Binary Tree
124. Binary Tree Maximum Path Sum
1465. Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts
501A - Contest
160A- Twins
752. Open the Lock
1535A - Fair Playoff
1538F - Interesting Function
1920. Build Array from Permutation
494. Target Sum
797. All Paths From Source to Target
1547B - Alphabetical Strings
1550A - Find The Array